# ./install -host user@host:port

#!/bin/bash
set -e

# 该变量需谨慎！！！ 为当前用户目录下的root_path, 后期执行过程中会删除该目录
root_path='pgsql'
shell_path='./'
shell_file='install.sh'
# 不可以/结尾
conf_path='conf'
# 不可以/结尾
tools_path='tools'

case $1 in
  -h) 
    printf "%-10s \t %s" '-h' 'show help document'
    printf "\n"
    printf "%-10s \t %s" '-host' 'e.g. user@host:port'
    break
    ;;
  -host)
    source ../../utils/upload_shell.sh
    host=$2
    shift 2
    upload_and_exec $@
    break
    ;;
  run)
    cd $root_path 
    source $conf_path'/'pgsql.conf
    sudo mkdir -p $pgsql_config_path $pgsql_volumes_path
    cd conf
    docker-compose config
    docker-compose up -d
    echo -e '\n'
esac

